#define _CRT_SECURE_NO_WARNINGS 1

#include <vector>
#include <time.h>
using namespace std;

class Solution {
public:
    void qsort(vector<int>& nums, int begin, int end)
    {
        if (begin >= end)
            return;
        int ikey = rand() % (end - begin + 1) + begin;
        int key = nums[ikey];
        int left = begin - 1, right = end + 1, i = begin;
        while (i < right)
        {
            if (nums[i] < key) swap(nums[++left], nums[i++]);
            else if (nums[i] == key) ++i;
            else swap(nums[--right], nums[i]);
        }
        qsort(nums, begin, left);
        qsort(nums, right, end);
    }
    vector<int> sortArray(vector<int>& nums) {
        srand(time(nullptr));
        qsort(nums, 0, nums.size() - 1);
        return nums;
    }
};